import {
  get,
  post,
  put,
  remove,
  APIURL
} from './config'

export const apiUploadUrl = 'http://192.168.100.19/'

export const uploadUrl = APIURL() + 'file/upload?type=img'

/**
 * ============== 登录 ==============
 */
// 获取登录验证码
export const getCodeImg = data => get('validatecode/getcode', data, 'blob')
// 生成动态码
export const getDynamicCode = data => post('validatecode/sendcode', data)
// 普通登陆
export const login = data => post('user/login', data)
// export const login = data => post('http://192.168.1.101:51106/user/login', data, 'json')
// 动态码登陆
export const loginByCode = data => post('user/dynamicLogin', data)
// 注销
export const loginOut = data => get('ucapi/user/logout', data)

/**
 * ============== 注册 ==========
 */
export const registerByPhone = data => post('user/registerByPhone', data)

export const registerByEmail = data => post('user/registerByEmail', data)
// 发送激活邮件
export const sendActivateEmail = data => post('user/sendActiveEmail', data)
// 邮箱账号激活
export const activateEmail = data => post('user/active', data)

export const getDynamicRegisterCode = data => post('validatecode/registercode', data)

/**
 * ============== 找回密码 ==========
 */
// 找回密码-验证身份
export const verifyUser = data => post('validatecode/verifyUser', data)
// 发送手机验证码
export const redeemByPhone = data => post('validatecode/redeemByPhone', data)
// 发送邮箱验证码
export const redeemByEmail = data => post('validatecode/redeemByEmail', data)
// 发送新邮箱验证码
export const redeemByNewEmail = data => post('validatecode/sendNewEmailVaildateCode', data)
// 修改密码
export const modifyPassword = data => post('ucapi/user/updatePassword', data)
// 验证找回验证码
export const verifyCode = data => post('validatecode/verifyCode', data)
// 保存提现账户
export const saveWithdrawalAccount = data => post('lts/withdrawal/account', data, 'json')
// 修改提现账户
export const updateWithdrawalAccount = data => put('lts/withdrawal/account', data, 'json')
/**
 * 用户管理
 */
export const getUserInfo = data => post('ucapi/ucenterUser/getInquireUser', data)
// export const getUserInfo = data => post('http://192.168.1.101:51104/ucapi/ucenterUser/getInquireUser', data)

export const modifyUserInfo = data => post('ucapi/userinfo/update', data)

export const modifyUserPhone = data => post('ucapi/userinfo/updatePhone', data)

export const getUserHistory = data => post('ucapi/loginHistory/get', data)

export const modifyUserEmail = data => post('ucapi/validatecode/modifyNewEmail', data)

// 是否完成评测
export const getUserRiskInfo = (data) => post('lts/riskassessment/find', data)

// 保存评测信息
export const saveUserRiskInfo = (data) => post('lts/riskassessment/save', data)

/**
 * 找高手
 */
export const getFieldTagList = data => get('ucapi/inquire/getFieldTagList', data)
export const getCertExpertList = data => post('ucapi/inquire/getCertExpertList', data)
export const getCertOrgsList = data => post('ucapi/inquire/getCertOrgsList', data)
export const getCertList = data => get('ucapi/cert/getCertList', data)

/**
 *  观点
 */
export const getViewpintInfo = data => post('lts/index', data)
export const getArticleList = data => post('lts/viewPoint/getLocationLevelPageList', data)
export const getAttentionArticleList = data => post('lts/viewPoint/getUserAttentionPageList', data)

export const getArticleDetail = data => post('lts/viewPoint/getDetail', data)
export const getMessagechatsDetail = id => get('lts/messagechats/detail/' + id)

// 标签列表页
export const getTagsList = data => post('lts/viewPoint/getPointTitle', data)

// 相关大咖或意见领袖
export const getTagsRelated = data => post('lts/viewPoint/getOpinionLeader', data)

/**
 * 主页
 */
export const getArticleByStatus = data => post('lts/viewPoint/getPageList ', data)

// export const getClassifyList = data => post('lts/classify/all', data)

export const getCertInfo = data => post('ucapi/ucenterUser/getCertInfo', data)
// 文章举报
export const handleReport = data => post('lts/tip/save', data)

/**
 * 关注
 */
export const modifyUserFocus = data => post('ucapi/userFocus/focus', data)

// 相关大咖或意见领袖
export const getClassifyList = data => post('lts/classify/all', data)

// 添加观点
export const getViewPointAdd = data => post('lts/viewPoint/save', data)
// 获取观点
export const getViewPointByid = data => post('lts/viewPoint/get', data)
// 修改观点
export const getViewPointModify = data => post('lts/viewPoint/modify', data)
// 撤回观点
export const getViewPointRecall = data => post('lts/viewPoint/recall', data)
// 删除观点
export const removeViewPoint = data => post('lts/viewPoint/remove', data)
// 热门观点
export const gethotPoint = data => post('lts/viewPoint/getNewArticleList', data)
// 看观点
export const gettjPoint = data => get('lts/index/recommend/viewpoint', data)

/**
 * 计划 普通用户页面
 * */
// 计划列表 最新
export const getLastPlanList = (data) => post('lts/plan/getNewestList', data)

// 计划列表 火热运行中
export const getHottestList = (data) => post('lts/plan/getHottestList', data)

// 牛人榜
export const getBestExpertList = (data) => post('lts/plan/getBestExpertList', data)

// 热门订阅
export const getBestSaleList = (data) => post('lts/plan/getBestSaleList', data)

// 获取大咖的计划
export const getPageListByUserId = (data) => post('lts/plan/getPageListByUserId', data)

// 订阅计划
export const doSubscribe = (data) => post('lts/subscribe', data)
// 获取计划详情信息
export const getPlanDetailInfo = (data) => post('lts/plan/detail', data)

// 获取置顶文章
export const getPlanTopArticle = (data) => post('lts/plan/topArticle', data)
// 获取试读文章
export const getPlanFreeArticle = (data) => post('lts/plan/freeArticle', data)
// 文章详情
export const getPlanArticleDetail = (data) => post('lts/article/getDetail', data)

// 计划文章列表分页
export const getPlanArticleList = (data) => post('lts/article/getPageList', data)

/**
 * 计划 专家页面
 * */
// 计划列表
export const getPlanListForAuthor = (data) => post('lts/plan/getPageListForAuthor', data)
// 添加计划
export const addPlan = (data) => post('lts/plan/save', data)
// 获取计划详情信息
export const getPlanSimpleInfo = (data) => post('lts/plan/info', data)
// 更新计划详情信息
export const updatePlanSimpleInfo = (data) => post('lts/plan/modify', data)

// 计划文章列表 专家页面
export const getPlanArticleListForAuthor = (data) => post('lts/article/getPageListForAuthor', data)
// 计划文章标签列表
export const getPlanArticleTagList = () => post('lts/articleTag/getList')
// 添加计划文章
export const addPlanArticle = (data) => post('lts/article/save', data)

// 计划文章详情信息
export const getPlanArticleInfo = (data) => post('lts/article/info', data)

// 计划文章详情点赞
export const praisePlanArticle = (data) => post('lts/article/praise', data)

// 计划文章详情收藏
export const favoritePlanArticle = (data) => post('lts/article/favorite', data)

// 取消计划文章详情收藏
export const unFavoritePlanArticle = (data) => post('lts/article/unfavorite', data)

// 打赏计划文章
export const planArticleReward = (data) => post('/lts/orders/planArticle', data, 'json')

// 我收藏的计划文章
export const myFavoritePlanArticle = (data) => post('lts/article/myFavorite', data)

// 添加计划文章
export const updatePlanArticle = (data) => post('lts/article/modify', data)

// 下单购买计划
export const orderPlan = (data) => post('lts/orders/plan', data)

//  取消订阅计划
export const cancelSubscribePlan = (data) => post('lts/plan/cancelSubscribe', data)

//  我购买的计划列表
export const mySubscribedPlan = (data) => post('lts/plan/getPageListForPaid', data)

//  我购买的、想购买但未支付的计划列表
export const myAllSubscribePlan = (data) => post('lts/plan/getPageListForPaidOrder', data)

//  订单删除
export const deleteOrder = (orderId) => remove('lts/orders/' + orderId)

/**
 * 问答 普通用户页面
 */
// 栏目列表
export const getQuestionCategory = (data) => post('lts/question/fieldandtags', data)

// 推荐大咖
export const getRecommendMaster = (data) => post('lts/question/recommend/user', data)

// 全部大咖
export const getRecommendMasterPage = (data) => post('lts/question/recommend/userpage', data)

// 问题回答列表
export const getQuestionAnswerList = (data) => post('lts/question/page/new', data)

// 问题详情
export const getQuestionDetail = (questionId) => post('lts/question/detail/' + questionId)

// 获取用户提问时的必备信息
export const getUserInfoForRaisingQuestion = (data) => post('lts/question/userwithfield', data)

// 点赞
export const starQuestion = (data) => post('lts/question/star', data)

// 取消点赞
export const unStarQuestion = (data) => post('lts/question/unstar', data)

// 收藏
export const followQuestion = (data) => post('lts/question/follow', data)

// 取消收藏
export const unFollowQuestion = (data) => post('lts/question/unfollow', data)

// 我的收藏
export const myFollowQuestion = (data) => post('lts/question/page/myfollow', data)

// 排行榜
export const questionRecord = (data) => post('lts/question/phb', data)

// 提问 新增问题
export const addQuestion = (data) => post('lts/question/add', data)

// 下单新增问题
export const orderQuestion = (data) => post('lts/orders/question', data)

// 下单解锁问题
export const orderQuestionBuyer = (data) => post('lts/orders/questionbuyer', data)

// 购买问题
export const buyQuestion = (questionId) => post('lts/question/buy/' + questionId)

// 我被提问的问题列表。包括我需要回答的，和未回答的
export const getMyReceivedQuestion = (data) => post('lts/question/page/myanswer', data)

// 我的提问列表
export const getRaiseQuestion = (data) => post('lts/question/page/my', data)

// 回答问题
export const answerQuestion = (data) => post('lts/answer/modify', data)

// 设置我回答问题得收费
export const setMyAnswereCharge = (data) => post('lts/qaUserExpend/add', data)
/**
 * 直播首页
 */
export const getLiveIndex = data => get('lts/webcastrooms/index', data)

/**
 * 我的钱包
 */
export const getWallet = data => get('lts/wallet/current', data)

export const getWalletIncome = data => get('lts/account/income/page', data)

export const getWalletExpend = data => get('lts/account/expend/page', data)

export const getWalletWithdrawal = data => get('lts/withdrawal/page', data)

export const applyWalletWithdrawal = data => post('lts/withdrawal', data, 'json')

/**
 * 我的直播
 */
export const getMyLive = data => post('lts/webcasttopics/page', data)
// 我的圈子——直播
export const getCicleLive = data => post('lts/webcastusers/circle/list', data)

export const updateLiveSubscription = data => post('lts/webcastusers/subscription', data, 'json')
/**
 *  我的打赏
 */
export const getRewardList = data => get('lts/orders/webcast/page', data)

// 直播排行榜
export const getZBRank = data => post('lts/webcastrooms/index/rank', data)
// 全部直播间
export const getZBRoomAll = data => post('lts/webcastrooms/index/style', data)
// 精选直播间
export const getZBRoomChoice = data => post('lts/webcastrooms/index/choice', data)
// 新晋主播
export const getZBAnchor = data => get('lts/webcastrooms/index/anchor', data)
// 每日推荐
export const getZBRecommend = data => get('lts/webcastrooms/index/recommend', data)
// 实时直播
export const getZBRealtime = data => post('lts/webcastrooms/index/realtime', data)
// 看直播
export const getZBwatch = data => get('lts/index/room/watch', data)
// 观点打赏
export const viewpointReward = data => post('lts/orders/viewpoint', data, 'json')
// 轮播图
export const getMovePicture = data => get(`lts/movePicture/${data.columnType}`, data)
// 精选计划
export const gethotPlan = data => get('lts/plan/getChoList', data)
// 意见反馈
export const addFeedback = data => post('lts/user/feedback', data)
/**
 * 投顾——我的收藏
 */
export const getCollectList = data => post('lts/collect/user', data)
export const updateCollectList = data => post('lts/collect', data)
export const updateCollectPraise = data => post('lts/praise/viewPoint', data)

// 获取评论列表
export const getComment = data => post('lts/comment/findPage', data)
export const addComment = data => post('lts/comment/save', data)
export const replyComment = data => post('lts/comment/reply', data)
export const likeComment = data => post('lts/comment/like', data)

// 充值
export const updateRecharge = data => post('lts/orders/recharge', data, 'json')
// 充值明细
export const getAssetRecharge = data => get('lts/account/recharge/page', data)

// 消息
export const getNews = data => get('lts/news/getNewsPage', data)
export const readNews = data => get('lts/news/read', data)
export const removeNews = data => remove('lts/news/delNews', data)
